﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLBH.ModelInterface;
using QLBH.DataModel;

namespace QLBH.FeatureModel
{
    public class KhachHangModel:IKhachHangModel
    {
        public DateTime CREATEDDATE {set;get;}       

        public string DIACHI {set;get;}       

        public string DIDONG {set;get;}       

        public string DIENTHOAI {set;get;}       

        public string EMAIL  {set;get;}      

        public string GHICHU {set;get;}       

        public string GIOITINH  {set;get;}      

        public bool ISKHTIEMNANG  {set;get;}      

        public string KHCODE  {set;get;}      

        public Guid KHID  {set;get;}      

        public string MASOTHUE {set;get;}       

        public DateTime NGAYSINH {set;get;}

        public string TENKH { set; get; }
        
        public void InitFromEntity(DataModel.KHACHHANG entity)
        {
            this.CREATEDDATE = (DateTime)entity.CREATEDDATE;
            this.DIACHI = entity.DIACHI;
            this.DIDONG = entity.DIDONG;
            this.DIENTHOAI = entity.DIENTHOAI;
            this.EMAIL = entity.EMAIL;
            this.GHICHU = entity.GHICHU;
            this.GIOITINH = entity.GHICHU;
            this.ISKHTIEMNANG = (bool)entity.ISKHTIEMNANG;
            this.KHCODE = entity.KHCODE;
            this.KHID = entity.KHID;
            this.MASOTHUE = entity.MASOTHUE;
            this.NGAYSINH = (DateTime)entity.NGAYSINH;
            this.TENKH = entity.TENKH;            
        }

        public KHACHHANG ToEntity()
        {
            KHACHHANG entity = new KHACHHANG();
            entity.CREATEDDATE = this.CREATEDDATE;
            entity.DIACHI = this.DIACHI;
            entity.DIDONG = this.DIDONG;
            entity.DIENTHOAI = this.DIENTHOAI;
            entity.EMAIL = this.EMAIL;
            entity.GHICHU = this.GHICHU;
            entity.GHICHU = this.GIOITINH;
            entity.ISKHTIEMNANG = this.ISKHTIEMNANG;
            entity.KHCODE = this.KHCODE;
            entity.KHID = this.KHID;
            entity.MASOTHUE = this.MASOTHUE;
            entity.NGAYSINH = this.NGAYSINH;
            entity.TENKH=this.TENKH;

            return entity;
        }
    }
}
